package com.hzlx.items.service.impl;

import java.util.List;

import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import com.hzlx.items.mapper.QualityInspectionItemsMapper;
import com.hzlx.items.domain.QualityInspectionItems;
import com.hzlx.items.service.IQualityInspectionItemsService;

/**
 * 检验项目明细（定义每个检验标准的具体检查项）Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-07-01
 */
@Service
public class QualityInspectionItemsServiceImpl implements IQualityInspectionItemsService 
{
    @Autowired
    private QualityInspectionItemsMapper qualityInspectionItemsMapper;
    @Resource
    private RedisTemplate<String, Object> redisTemplateObject;
    String KEY = "quality-service:quality_inspection_items";
    /**
     * 查询检验项目明细（定义每个检验标准的具体检查项）
     * 
     * @param itemId 检验项目明细（定义每个检验标准的具体检查项）主键
     * @return 检验项目明细（定义每个检验标准的具体检查项）
     */
    @Override
    public QualityInspectionItems selectQualityInspectionItemsByItemId(String itemId)
    {
        return qualityInspectionItemsMapper.selectQualityInspectionItemsByItemId(itemId);
    }

    /**
     * 查询检验项目明细（定义每个检验标准的具体检查项）列表
     * 
     * @param qualityInspectionItems 检验项目明细（定义每个检验标准的具体检查项）
     * @return 检验项目明细（定义每个检验标准的具体检查项）
     */
    @Override
    public List<QualityInspectionItems> selectQualityInspectionItemsList(QualityInspectionItems qualityInspectionItems)
    {
        List<QualityInspectionItems> list = qualityInspectionItemsMapper.selectQualityInspectionItemsList(qualityInspectionItems);
        redisTemplateObject.opsForValue().set(KEY,list);
        return list;  }

    /**
     * 新增检验项目明细（定义每个检验标准的具体检查项）
     * 
     * @param qualityInspectionItems 检验项目明细（定义每个检验标准的具体检查项）
     * @return 结果
     */
    @Override
    public int insertQualityInspectionItems(QualityInspectionItems qualityInspectionItems)
    {
        return qualityInspectionItemsMapper.insertQualityInspectionItems(qualityInspectionItems);
    }

    /**
     * 修改检验项目明细（定义每个检验标准的具体检查项）
     * 
     * @param qualityInspectionItems 检验项目明细（定义每个检验标准的具体检查项）
     * @return 结果
     */
    @Override
    public int updateQualityInspectionItems(QualityInspectionItems qualityInspectionItems)
    {
        return qualityInspectionItemsMapper.updateQualityInspectionItems(qualityInspectionItems);
    }

    /**
     * 批量删除检验项目明细（定义每个检验标准的具体检查项）
     * 
     * @param itemIds 需要删除的检验项目明细（定义每个检验标准的具体检查项）主键
     * @return 结果
     */
    @Override
    public int deleteQualityInspectionItemsByItemIds(String[] itemIds)
    {
        return qualityInspectionItemsMapper.deleteQualityInspectionItemsByItemIds(itemIds);
    }

    /**
     * 删除检验项目明细（定义每个检验标准的具体检查项）信息
     * 
     * @param itemId 检验项目明细（定义每个检验标准的具体检查项）主键
     * @return 结果
     */
    @Override
    public int deleteQualityInspectionItemsByItemId(String itemId)
    {
        return qualityInspectionItemsMapper.deleteQualityInspectionItemsByItemId(itemId);
    }
}
